<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>MongoTimestamp 类</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongomaxkey.html">MongoMaxKey</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongotimestamp.construct.html">MongoTimestamp::__construct</a></div>
 <div class="up"><a href="mongo.types.html">Types</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.mongotimestamp" class="reference">

 <h1 class="title">MongoTimestamp 类</h1>
 

 <div class="partintro"><p class="verinfo">(PECL mongo &gt;=1.0.1)</p>


  <div class="section" id="mongotimestamp.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <strong class="classname">MongoTimestamp</strong> 用于分片（sharding）。
    如果你不是想写分布式工具，你需要的也许是
    <a href="class.mongodate.html" class="classname">MongoDate</a>。
   </p>
   <p class="para">
    <strong class="classname">MongoTimestamp</strong> 
    是 4 字节的时间戳（自新纪元以来的秒数），和 4 字节的自增长值。
   </p>
   <p class="para">
    <em class="emphasis">
     这个类不用于测量时间、为文档创建时间戳或为一个文档自动增加、更新时间戳。
    </em>
    除非你写的是关于分片式内部的交互，否则请停下，直接前往 <a href="class.mongodate.html" class="classname">MongoDate</a>，
    不要再继续研究这个东西。这不是你要找的类。
   </p>
   <p class="para">
    如果你在写一个分片工具，继续阅读。
   </p>
  </div>


  <div class="section" id="mongotimestamp.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">MongoTimestamp</strong>
     </span>
     {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 字段 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname">$<var class="varname">sec</var></var>
     <span class="initializer"> = 0</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname">$<var class="varname">inc</var></var>
     <span class="initializer"> = 0</span>
    ;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="mongotimestamp.construct.html" class="methodname">__construct</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$sec</code><span class="initializer"> = time()</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$inc</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="mongotimestamp.tostring.html" class="methodname">__toString</a></span>
    ( <span class="methodparam">void</span>
   )</div>
 

   }</div>


  </div>
 </div>

 



















<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="mongotimestamp.construct.html">MongoTimestamp::__construct</a> — 创建一个新的时间戳。</li><li><a href="mongotimestamp.tostring.html">MongoTimestamp::__toString</a> — 返回时间戳的字符串表示形式</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongomaxkey.html">MongoMaxKey</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongotimestamp.construct.html">MongoTimestamp::__construct</a></div>
 <div class="up"><a href="mongo.types.html">Types</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
